{include file="public/_meta" /}
<body>
<style>
    .required_b{
        color: red;
    }
</style>
<div class="wrapper">

    {include file="public/_header" /}

    <!-- Sidebar -->
    {include file="public/_menu" /}
    <!-- End Sidebar -->

    <div class="main-panel">

        <div class="content">
            <div class="page-inner">

                <!-- 面包屑 -->
                {include file="public/_page_header" /}

                <div class="row">
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-header">


                                <form class="row">

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="id" value="{$id}" placeholder="请输入ID">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="pro_name" value="{$pro_name}" placeholder="请输入产品名称">
                                        </div>
                                    </div>


                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="mer_name" value="{$mer_name}" placeholder="请输入商户名称">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="cityname" value="{$cityname}" placeholder="请输入城市">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="times" id="times" value="{$times}" placeholder="日期" autocomplete="off">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <select class="form-control input-full" name="orderb" id="orderb">
                                                <option value="0">排序</option>
                                                <option value="1" {if condition="$orderb eq 1"}selected{/if}>城市升序</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <button type="submit" class="btn btn-primary">查询</button>
                                            <a href="{:url('push/record')}" class="btn btn-info" style="color: white;position: absolute;left: 110px;">重置</a>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <div class="btn btn-info" onclick="recostprice()" style="">刷新成本</div>
                                        </div>
                                    </div>

                                </form>

                            </div>


                            <div class="layui-card-body">

                                <blockquote class="layui-elem-quote layui-quote-nm">
                                    <div class="table-responsive">
                                        <table id="add-row2" class="display table table-striped table-hover" >
                                            <thead>
                                            <tr>
                                                <th>总计</th>
                                                <th>分发线索数</th>
                                                <th>账户成本</th>
                                                <th>真实成本</th>
                                                <th>修正账户成本</th>
                                                <th>修正真实成本</th>
                                            </tr>
                                            </thead>

                                            <tbody>

                                            <tr>
                                                <td>{$calc['sum']}</td>
                                                <td>{$calc['clue_num']}</td>
                                                <td>{$calc['price']}</td>
                                                <td>{$calc['true_price']}</td>
                                                <td>{$calc['xz_price']}</td>
                                                <td>{$calc['xz_true_price']}</td>
                                            </tr>

                                            </tbody>
                                        </table>


                                    </div>


                                </blockquote>
                            </div>

                            <div class="card-body">
                                <div class="table-responsive">
                                    <table id="add-row" class="display table table-striped table-hover" >
                                        <thead>
                                        <tr>
                                            <th>记录ID</th>
                                            <th>分发规则ID</th>
                                            <th>日期</th>
                                            <th>投放产品</th>
                                            <th>接收商户</th>
                                            <th>投放城市</th>
                                            <th>每日接收上限</th>
                                           <!-- <th>投放时间</th>-->
                                            <th>分发线索数</th>
                                            <th>账户成本</th>
                                            <th>真实成本</th>
                                            <th>真实成本单价</th>
                                            <th>修正账户成本</th>
                                            <th>修正真实成本</th>
                                            <th>修正真实成本单价</th>
                                        </tr>
                                        </thead>

                                        <tbody>

                                        {volist name="infos" id="vo"}
                                        <tr>
                                            <th>{$vo.id}</th>
                                            <td>{$vo.push_id}</td>
                                            <td>{$vo.create_date}</td>
                                            <td>{$vo.pro_name}</td>
                                            <td>
                                                {$vo.mer_name}<br>
                                                余额：{$vo.balance}
                                            </td>
                                            <td>{$vo.city}</td>
                                            <td>{$vo.up_limit}</td>
                                            <!--<td>
                                                时间：{$vo.timing_time}<br>
                                                {$vo.week_arr}
                                            </td>-->
                                            <td>{$vo.push_num}</td>
                                            <td>{$vo.price}</td>
                                            <td>{$vo.true_price}</td>
                                            <td>{$vo.one_true_price}</td>
                                            <td>{$vo.xz_price}</td>
                                            <td>{$vo.xz_true_price}</td>
                                            <td>{$vo.one_xz_true_price}</td>
                                        </tr>
                                        {/volist}

                                        </tbody>
                                    </table>

                                    <!-- 分页 (调取通用方法)-->

                                </div>
                            </div>
                        </div>
                    </div>
                </div>


            </div>
        </div>

        {include file="public/_footer" /}


    </div>



</div>

{include file="public/_js" /}

<script type="text/javascript">
    laydate.render({
        elem: '#times'
        ,type: 'date'
        ,range: true
    });

    function recostprice(){
        var times=$('#times').val();
        layer.confirm('确认要刷新成本吗？',function(index){
            var loading = layer.load('加载中...', {
                shade: [0.3,'#fff'] //0.1透明度的白色背景
            });
            $.ajax({
                type: 'POST',
                url: "{:url('push/reCostPriceQueue')}",
                dataType: 'json',
                data: {times:times},
                success: function(data){
                    layer.close(loading);
                    if(data.code == 1001){
                        layer.msg(data.msg,{icon:1,time:2000});
                    }else{
                        layer.msg(data.msg,{icon:2,time:2000});
                    }

                },
                error:function(data) {
                    layer.msg('网络错误,稍后再试...',{icon:2,time:2000});
                }
            });
        });
    }
</script>

</body>

</html>